//
//  WorldWindow.h
//  Editor
//
//  Created by Jeppe Nielsen on 11/5/14.
//  Copyright (c) 2014 Jeppe Nielsen. All rights reserved.
//
#pragma once
#include "ToolWindow.hpp"
#include <QtWidgets/QtWidgets>
#include "WorldTreeModel.hpp"

class GameObjectModel;

class WorldWindow : public ToolWindow {
    Q_OBJECT
protected:


    std::string GetName();
    void OnCreate();
private:
    void ProjectChanged(Property<Context*, Project*>::EventData d);
    void CreateContextMenu();
    void CreatePropertyEditors();
    void InspectGameObject(GameObject* gameObject);

    QMenu* contextMenu;
    QAction* menuRename;
    QAction* menuDelete;
    
    

    QTreeView* treeView;
    WorldTreeModel model;
    
    QTreeView* propertyView;
    GameObjectModel* currentGameObject;
    
    
private slots:
    void SelectionChanged(const QModelIndex &current, const QModelIndex &previous);
    void onCustomContextMenu(const QPoint& point);
    void propertyDataChanged(QWidget *editor, QAbstractItemDelegate::EndEditHint hint = QItemDelegate::NoHint);

};